package behaviour.building;

import agent.BuildingAgent;
import jade.core.behaviours.CyclicBehaviour;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.MessageTemplate;

public class ReceiveGoBackBehaviour extends CyclicBehaviour {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8157680316086240813L;

	@Override
	public void action() {
		MessageTemplate mt = MessageTemplate.MatchConversationId("go-back");
		ACLMessage msg = myAgent.receive(mt);
		if(msg != null) {
			BuildingAgent agent = (BuildingAgent) myAgent;
			agent.goBack();
		}
		else
			block();

	}

}
